package day6;

/**
 * @author oldliu
 * @since 1.0
 */
public class Arr7 {
    public static void main(String[] args) {
        int []ar={1,2,22,55,23,14,233,6,66,145,10,16};
        System.out.println("排序前：");
        for(int i:ar)
            System.out.print(i+"\t");
        System.out.println();
        int temp;
        for(int i=0;i<ar.length-1;i++){
            for(int j=0;j<ar.length-1-i;j++){
                //j和j+1比较
                if(ar[j]>ar[j+1]){
                    temp=ar[j];
                    ar[j]=ar[j+1];
                    ar[j+1]=temp;
                }
            }
        }
        System.out.println("排序后:");
        for(int i:ar)
            System.out.print(i+"\t");
        System.out.println();
    }

}
